﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PractikLesson4DateTime
{
    class Program
    {
        static void Main(string[] args)
        {
            //PrintFridayOfNextYear();
            //PrindFridayThisYear();
            //CalcNumbOfDays();

            int i = 100;
            int resultsFound = 0;
            int currentYear = DateTime.Today.Year;


            while (resultsFound < i)
            {
                if (IsLeapYear(++currentYear))
                {
                    Console.WriteLine(currentYear);
                    resultsFound++;
                }
            }
            Console.ReadKey();

        }

        static void PrintFridayOfNextYear()
        {
            DateTime dt = new DateTime(DateTime.Today.Year + 1, 1, 1);
            int nextYear = DateTime.Today.Year + 1;
            while (dt.Year == nextYear)
            {
                if (dt.DayOfWeek == DayOfWeek.Friday)
                {
                    Console.WriteLine(dt.ToString("dddd MMMM yyyy"));
                }
                dt = dt.AddDays(1);
            }
            Console.ReadKey();
        
        }
        
        static void PrindFridayThisYear()
        {
         DateTime dt = DateTime.Today;
            while(dt.Year == DateTime.Today.Year)
            {
                if (dt.DayOfWeek == DayOfWeek.Friday)
                {
                    Console.WriteLine(dt.ToString("dddd MMMM yyyy"));
                }
                dt = dt.AddDays(1);
            }
            Console.ReadKey();
         }
        static int CalcNumbOfDays(int year)
        {
            int i = 0;

            DateTime dt = new DateTime(year, 1, 1);
            DateTime dt2 = new DateTime(year, 12, 31);
            
            while (dt != dt2)
            {
                dt = dt.AddDays(1);
                i++;
            }
            return i;   
        }

        static bool IsLeapYear(int year)
        {
            return CalcNumbOfDays(year) == 365;
        }
    }
            
}

    

